<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>@yield('title') | 斯瑞CMS</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <meta http-equiv="Access-Control-Allow-Origin" content="*">

    <meta name="_token" content="{{ csrf_token() }}"/>
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <!-- Bootstrap Datetimepicker -->
    <link rel="stylesheet" href="/bootstrap/datetimepicker/css/datetimepicker.css">
    <link rel="stylesheet" href="/bootstrap/datetimepicker/css/dropdown.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="/libs/font-awesome/4.5.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="/libs/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
          page. However, you can choose any other skin. Make sure you
          apply the skin class to the body tag so the changes take effect.
    -->
    <link rel="stylesheet" href="/dist/css/skins/skin-blue.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    {{--dataTabels--}}
    {{--<link href="/plugins/datatables/jquery.dataTables.min.css" rel="stylesheet">--}}
    <link href="/plugins/datatables/dataTables.bootstrap.css" rel="stylesheet">

    {{--loding--}}
    <link href="/dist/css/load/load.css" rel="stylesheet">
  <link rel="stylesheet" href="/plugins/iCheck/square/blue.css">
  
</head>

<body class="hold-transition skin-blue sidebar-mini">
<div id="loading">
    <div id="loading-center">
        <div id="loading-center-absolute">
            <div class="object" id="object_four"></div>
            <div class="object" id="object_three"></div>
            <div class="object" id="object_two"></div>
            <div class="object" id="object_one"></div>
        </div>
    </div>
</div>
<div class="wrapper">

    <!-- Main Header -->
@include('admin.layouts.mainHeader')
<!-- Left side column. contains the logo and sidebar -->
@include('admin.layouts.mainSidebar')
<!-- Content Wrapper. Contains page content -->

    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            {{--<h1>
              @yield('pageHeader')
              <small>@yield('pageDesc')</small>
            </h1>
            <ol class="breadcrumb">
              <li><a href="/admin"><i class="fa fa-dashboard"></i> 控制面板</a></li>
              <li class="active">Here</li>
            </ol>--}}
            <h6>
                {!! Breadcrumbs::render(Route::currentRouteName()) !!}
            </h6>
        </section>

        <!-- Main content -->
        <section class="content">
		{{--进度条--}}
	<div class="modal fade" id="modal-progress" tabIndex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">
                        ×
                    </button>
                    <h4 class="modal-title">提示</h4>
                </div>
                <div class="modal-body">
                    <p class="lead">
						<i>正在更新 [<i id="content"></i>] </i>
                        <div class="progress">
						  <div id="progressbar" class="progress-bar progress-bar-success" role="progressbar" aria-valuemin="0" aria-valuemax="100" style="width:10%;min-width:10%;">
							<span class="" style="text-align:center;"><span id="per">0</span>%(<span id="ing">0</span>/<span id="total">0</span>)</span>
						  </div>
						</div>
                    </p>
					<p id="msg" style="word-wrap:break-word;"><i style='color:red;'>错误的域名：</i></p>
                </div>
                <div id="updatetel" class="modal-footer">
                    <button type="button" onclick="updateGroupTel2('toStart')" class="btn btn-success">开始执行</button>
					<!--<button type="button" onclick="updateGroupTel2('toStart')" class="btn btn-danger">强制执行</button>-->
                    <!--<button type="button" class="btn btn-default" data-dismiss="modal">新窗口更新</button>-->
                </div>

            </div>
        </div>
    </div>
        @yield('content')
        <!-- Your Page Content Here -->

        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->


    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <!-- Create the tabs -->
        <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
            <li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
            <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
        </ul>
        <!-- Tab panes -->
        <div class="tab-content">
            <!-- Home tab content -->
            <div class="tab-pane active" id="control-sidebar-home-tab">
                <h3 class="control-sidebar-heading">Recent Activity</h3>
                <ul class="control-sidebar-menu">
                    <li>
                        <a href="javascript::;">
                            <i class="menu-icon fa fa-birthday-cake bg-red"></i>

                            <div class="menu-info">
                                <h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

                                <p>Will be 23 on April 24th</p>
                            </div>
                        </a>
                    </li>
                </ul>
                <!-- /.control-sidebar-menu -->

                <h3 class="control-sidebar-heading">Tasks Progress</h3>
                <ul class="control-sidebar-menu">
                    <li>
                        <a href="javascript::;">
                            <h4 class="control-sidebar-subheading">
                                Custom Template Design
                                <span class="label label-danger pull-right">70%</span>
                            </h4>

                            <div class="progress progress-xxs">
                                <div class="progress-bar progress-bar-danger" style="width: 70%"></div>
                            </div>
                        </a>
                    </li>
                </ul>
                <!-- /.control-sidebar-menu -->

            </div>
            <!-- /.tab-pane -->
            <!-- Stats tab content -->
            <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
            <!-- /.tab-pane -->
            <!-- Settings tab content -->
            <div class="tab-pane" id="control-sidebar-settings-tab">
                <form method="post">
                    <h3 class="control-sidebar-heading">General Settings</h3>

                    <div class="form-group">
                        <label class="control-sidebar-subheading">
                            Report panel usage
                            <input type="checkbox" class="pull-right" checked>
                        </label>

                        <p>
                            Some information about this general settings option
                        </p>
                    </div>
                    <!-- /.form-group -->
                </form>
            </div>
            <!-- /.tab-pane -->
        </div>
    </aside>
    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>

<!-- ./wrapper -->


<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 2.2.0 -->
<script src="/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/bootstrap/js/bootstrap.min.js"></script>
<!-- AdminLTE App -->
<script src="/dist/js/app.min.js"></script>

<!-- dataTables -->
<script src="/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="/plugins/datatables/dataTables.bootstrap.js"></script>
<script src="/dist/js/common.js"></script>

<!-- Bootstrap 3.3.6 -->
<script type="text/javascript" src="/bootstrap/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/bootstrap/datetimepicker/js/bootstrap-datetimepicker.zh-CN.js"
        charset="UTF-8"></script>

<script type="text/javascript" src="/js/jqmeter.min.js"></script>
<!-- Optionally, you can add Slimscroll and FastClick plugins.
     Both of these plugins are recommended to enhance the
     user experience. Slimscroll is required when using the
     fixed layout. -->
@yield('js')
<script type="text/javascript">
    $(function () {
        $('.date').datetimepicker({
            format: 'yyyy-mm-dd',
            language: "zh-CN",
            minView: 2,
			todayBtn: true,
            autoclose: true
        });
        $('.time').datetimepicker({
            format: 'yyyy-mm-dd hh:ii:ss',
            language: "zh-CN",
            minView: 2,
			todayBtn: true,
            autoclose: true
        });
		
        //上传图片
        $('input[id=lefile]').change(function () {
            $('#photoCover').val($(this).val());
        });

    });
    //    ################
    $(function () {
        //全选或全不选
        $("#all").click(function () {
            $("input[name='itemCB[]']").prop("checked", $(this).prop("checked"));
        });
    });
    //批量删除
    function batchDel() {
        var valArr = new Array;
        $(".itemCB").each(function (i) {
            if (this.checked) {
                //valArr[i] = $(this).val();
				valArr.push($(this).val());
            }
        });
        var ids = valArr.join(',');
        if (valArr.length > 0) {
            $('.batchDelForm').attr('action', $('.batchDelForm').attr('action')+'/'+ids);
            $("#modal-batch-del").modal();
			$(".btnOK").attr("disabled","disabled");
				var ts = 3;
				var set_interval = setInterval(function(){
					ts--;
					$('.ts').html(ts);
					if(ts==0){
						$(".btnOK").removeAttr("disabled");
						clearInterval(set_interval);
					}
			  },1000); 
        }
    }
	//新增微信调用值
	var add_id = 0;
	function addWechatValue(){
		var addid = "t_"+(++add_id);
		var key = $("input[name=add_key]").val();
		var value =$("input[name=add_value]").val();
		$("#display_values").append('<h3 style="margin-top:0px;"><span class="label label-default">'+key+' >> '+value+'</span> <i id="'+addid+'" class="fa fa-minus-circle del"></i></h3>');
		$("#display_values").append('<input id="'+addid+'" type="hidden" name="add_keys_values[]" value="{\''+key+'\':\''+value+'\'}"/>');
		$('#modal-addWechatValue').modal('hide')
	}
	//打开新增键值表单
	function openAddModal(){
		$("input[name=add_key]").val('');
		$("input[name=add_value]").val('');
		$("#modal-addWechatValue").modal();
	}
/* 	//更新模板
	function updateTel(domain,did,directory){
		loadShow();
		$.post("/admin/domain/crossUpTpl",{ domain:domain,did:did,directory:directory,_token:'{{ csrf_token() }}'},function(data){ loadFadeOut();showSuccess();}).error(function() { loadFadeOut();showError(); });
	} */

	function updateTel(id,tpl_id,userToken){ 
		loadShow(); 
		$.post("/admin/domain/crossUpTpl",{ id:id,tpl_id:tpl_id,userToken:userToken,_token:'{{ csrf_token() }}'},function(data){ console.log(data);loadFadeOut();if(data=='error'){showError();}else{showSuccess();}}).error(function() { loadFadeOut();showError(); });
	}
	function updateGroupTel(id){
		$.post("/admin/domain/per",{id:id,_token:'{{ csrf_token() }}'},function(data){ if(data.debug){ $("#msg").html("<i style='color:red;'>请关闭  debug 再操作！ </i>"); $("#updatetel .btn").attr("disabled",true);}else{$("#msg").html("<i style='color:red;'>错误的域名：</i>");$("#updatetel .btn").attr("disabled",false);}showProgress(data.count);});
		/* loadShow();
		$.post("/admin/domain/crossGUpTpl",{ id:id,_token:'{{ csrf_token() }}'},function(data){ loadFadeOut();console.log(data);showSuccess();}).error(function() { loadFadeOut();showError(); }); */
	}
	var s;var appendArr = new Array();
	function updateGroupTel2(start){ //开始执行
		s = start;
		$.post("/admin/domain/crossGUpTpl",{ start:start,_token:'{{ csrf_token() }}'},
		function(data){ console.log(data);
			if(data.status==200){
				$("#progressbar").removeClass("progress-bar-success");
				$("#progressbar").removeClass("progress-bar-danger");
				$("#progressbar").addClass("progress-bar-info");
				if(data.msg!='finish'){
					if(data.msg!=""&&$.inArray(data.msg,appendArr)==-1){
						appendArr.push(data.msg);
						$("#msg").append("<i class='"+data.msg+"' style='color:red;'>"+data.msg+"</i>、");
					}
					updateGroupTel2(s);
				}else{
					$("#progressbar").removeClass("progress-bar-info");
					$("#progressbar").addClass("progress-bar-success");
				}
			}else{
				if($.inArray(data.msg,appendArr)==-1){
					appendArr.push(data.msg);
					$("#msg").append("<i class='"+data.msg+"' style='color:red;'>"+data.msg+"</i>、");
				}
				$("#progressbar").removeClass("progress-bar-success");
				$("#progressbar").removeClass("progress-bar-info");
				$("#progressbar").addClass("progress-bar-danger");
			}
			$("#per").html(data.per);
			$("#ing").html(data.count);
			$("#content").html(data.domain);
			$("#progressbar").css('width',data.per+"%");
			//console.log(data);
		}).error(function() { showError(); });
	}
	function updateTels(){ //批量更新域名模板
		var valArr = new Array;
        $(".itemCB").each(function (i) {
            if (this.checked) {
				valArr.push($(this).val());
            }
        });
		var userToken ="{{Cache::get('userToken')}}";
		loadShow();
		$.ajaxSetup({async:false});
        $.each(valArr,function(key,val){ 
			$.post("/admin/domain/crossUpTpl",{ id:val,userToken:userToken,_token:'{{ csrf_token() }}'},function(data){ console.log(data);});
		});
		showSuccess();
		loadFadeOut();
	}
	//批量更新分组模板
	function updateGroupTels(){
		var ids = "";
        $(".itemCB").each(function (i) {
            if (this.checked) {
				ids += $(this).val()+",";
            }
        });
		//var userToken ="{{Cache::get('userToken')}}";
		$.post("/admin/domain/per",{id:ids,_token:'{{ csrf_token() }}'},function(data){ if(data.debug){ $("#msg").html("<i style='color:red;'>请关闭  debug 再操作！ </i>"); $("#updatetel .btn").attr("disabled",true);}else{$("#msg").html("<i style='color:red;'>错误的域名：</i>");$("#updatetel .btn").attr("disabled",false);}showProgress(data.count);});
		
	}
</script>
<script src="/plugins/iCheck/icheck.min.js"></script>
<script>
  $(function () {
   /*  $('label input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    }); */
	 $('.label input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    });
  });
</script>
<!-- Main Footer -->
@include('admin.layouts.mainFooter')

</body>
</html>
